package l.l.w.CodingInterviews.jingdong;

import java.util.Scanner;
import java.util.Stack;

/**
 * Created by llw on 2018/4/9/0009.
 */
public class Three {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int t = scanner.nextInt();
        scanner.nextLine();
        for(int i = 0; i < t; ++i){
            String line = scanner.nextLine();
            String res = getResult(line);
            System.out.println(res);
        }
    }

    private static String getResult(String line) {
        Stack<Character> stack = new Stack<>();
        boolean flag = false;
        for(int i = 0; i < line.length(); ++i){
            char c = line.charAt(i);
            if(c == ')'){
                if(!stack.isEmpty() && stack.peek() == '('){    //如果正确的话
                    stack.pop();
                }else{                  //如果错误的话，可以替换一下，相当于移动了一个位置
                    stack.push('(');
                    //记录一些信息
                    flag = true;
                }
            }else{
                stack.push(c);
            }
        }
        if(stack.size() == 2 && flag){
            if(stack.pop() == '(' && stack.pop() == '(')
                return "Yes";
        }
        if(stack.isEmpty() && !flag){
            if(line.length() > 2) return "Yes";
        }
        return "No";
    }
}
